package com.tyros.storage.modules.file.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tyros.common.kit.web.model.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 资源文件表
 *
 * @author zhangshuaiyin
 * @since 1.0.0 2022-02-19
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@TableName("resource_file")
public class FileEntity extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 对外openId
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private String openId;

    /**
     * 文件名
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String name;

    /**
     * 文件后缀
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String extension;

    /**
     * 文件大小字节数，单位byte
     */
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private Long size;

    /**
     * 文件md5值
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String md5;

    /**
     * 文件SHA256值
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String sha256;

    /**
     * 存储类型 1-本地 2-FastDFS
     */
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private Integer storageType;

    /**
     * 存储路径
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String path;

    /**
     * objectKey
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String objectKey;

    /**
     * 原始文件名
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String originalName;

    /**
     * 逻辑删除字段 0-未删除 1-已删除
     */
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private Integer deleted;

}
